/**
 * @Description 留宿申请的控制层
 * @author 20155870 杨润增
 * @create 2018-05-06 14:11
 **/
package com.academic_system.controller;

import com.academic_system.model.Notice;
import com.academic_system.service.NoticeService;
import com.academic_system.util.Message;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;




/**
 * @className NoticeController
 * @Description 公告管理的控制层
 **/
@Controller
@RequestMapping("/notice")
@ResponseBody

@CrossOrigin(origins = "*")
public class NoticeController {
    @Autowired
    private NoticeService noticeService;



    @RequestMapping(value = "/addNotice",method = RequestMethod.POST)
    public Message addNotice(@RequestBody Notice notice){
        return noticeService.addNotice(notice);
    }
    @RequestMapping(value = "/deleteNotice",method = RequestMethod.GET)
    public Message deleteNotice(@Param("noticeId") Integer noticeId){
        return noticeService.deleteNotice(noticeId);
    }

    @RequestMapping(value = "/queryNotice",method = RequestMethod.GET)
    public Message queryNotice(){
        return noticeService.queryAllNotice();
    }

    @RequestMapping(value = "/updateNotice",method = RequestMethod.POST)
    public Message updateNotice(@RequestBody Notice notice){
        return noticeService.updateNotice(notice);
    }

    @RequestMapping(value = "/queryANotice",method = RequestMethod.GET)
    public Message queryANotice(@Param("noticeId") Integer noticeId){
        return noticeService.queryNoticeById(noticeId);
    }





}
